var CreateCommandList = {
	"R" : "开始节点",
	"U" : "普通节点",
	"F" : "分支节点",
	"J" : "汇聚节点",
	"D" : "判断节点",
	"E" : "结束节点",
	"S" : "分支任务节点",
	"M" : "汇聚任务节点"
};

function CommandCreateNode(context, activity) {
	if ( context.command == undefined || context.command == "line" || context.command == "") {
		return null;
	}
	// 开始节点只能绘制一个
	if (context.command == "R" && context.getActivityByType("R").length > 0) {
		return null;
	}
	//var activity = new Activity();
	if (!activity) {
		activity = new Activity();
		activity.sid = context.getUuid();
		activity.isAsync = "0";
		activity.isMultiTask = "0";
		activity.url ="";
		activity.clazz = context.command;
		activity.name = context.command == "R" ? CreateCommandList[context.command] : CreateCommandList[context.command] + parseInt(context.getActivityByType(context.command).length + 1);
		activity.alias = activity.name;
		activity.x = context.x;
		activity.y = context.y;

		var participation = {
			activitySid: activity.sid,
			type: 0,
			participationCname: "全单位",
			participationSid: 0,
			processDefinitionSid: context.sid
		};
		activity.activityParticipationList = [participation];
	}
	if (activity.clazz != "R") {
		activity.name = activity.name;
	}
	if (context.addActivity(activity)) {
		StartNode(context, activity);
		return activity;
	} else {
		return null;
	}
}